package me.zhengjie.modules.web.enums;

import me.zhengjie.utils.StringUtils;

/**
 * 验证码场景
 */
public enum VerifyCodeSceneEnum {
    ModifyMobile("ModifyMobile","修改手机号"),
    TeamTesting("TeamTesting","团体测评"),
    SignIn("SignIn","签到"),
    ;

    VerifyCodeSceneEnum(String scene, String desc) {
        this.scene = scene;
        this.desc = desc;
    }

    public static String getRedisKey(String key,VerifyCodeSceneEnum sceneEnum){
        return sceneEnum.getScene()+"_"+key;
    }
    public static VerifyCodeSceneEnum getEnumByScene(String scene){
        if (StringUtils.isBlank(scene)){
            return null;
        }
        for (VerifyCodeSceneEnum value : VerifyCodeSceneEnum.values()) {
            if (value.getScene().equals(scene)){
                return value;
            }
        }
        return null;
    }
    private String scene;
    private String desc;

    public String getScene() {
        return scene;
    }

    public String getDesc() {
        return desc;
    }
}
